Introduction

This reading highlights some key concepts explained previously and focuses on how to set up a new React Native project. Specifically, you’ll be reminded of what tools you can use to build React Native apps, which you might choose depending on your level of experience and the degree of control you wish to have. You’ll also go over what you need to get your machine development-ready, and what you need to run an app on a physical device, emulator, or simulator.

React Native Overview

Let’s start with a quick recap of what React Native is.

React Native is a mobile application development framework that allows developers to build natively rendered mobile apps for Android and iOS. It uses JavaScript and the React library to do this. It was initially developed by Facebook and is now maintained by a community of developers.

One of the main benefits of React Native is that it allows developers to build mobile apps that perform similarly to native apps written in Kotlin or Swift, but with the added flexibility and power of the JavaScript ecosystem. This makes it an attractive option for building cross-platform mobile apps that run on multiple platforms with a single codebase.

There are several ways to start a new project, relaying on various levels of experience with native mobile development. One of the simplest tools used to start a project is Expo.

Expo Overview

Expo is a toolchain, or a set of software development tools, for building, deploying, and managing React Native applications. The libraries and set of tools within Expo make the development and deployment process easier for React Native apps. It also offers a platform for hosting and distributing your apps.

Expo is particularly useful for developers who want to build cross-platform React Native apps without having to set up a native development environment or learn the inner workings of Android Studio and XCode.

Native features are easily accessible, and app deployment to multiple platforms is seamless.

Expo will require a recent version of Node.js and a physical device or an emulator. Also, if you would like to explore React Native directly in your web browser before installing anything on your computer, go ahead and try out Snack, a React Native web-based code editor.

React Native CLI

If you are a seasoned mobile developer with experience in native development, you can use React Native CLI. To get started, install both XCode and Android Studio.

If you already have them installed, you’ll be up and running in a few minutes. However, If you're just getting started, installing and configuring XCode and Android Studio takes approximately an hour.

React Native CLI gives you full control over all aspects of your React Native project. You can access the underlying native Android and iOS projects and perform modifications in any native file if needed. Keep in mind that having greater control also means more complexity; as a general rule, it is recommended to pick an option that you feel confident with, but that also meets your needs.

Starting up a new project with Expo

For now, use the Expo ecosystem to set up and develop your React Native application. For example, to create a new Expo project called MyProject , run the following set of commands:

npx create-expo-app MyProject

cd MyProject

npm start

The last command starts the development server for you.

Finally, to run your React Native application on a physical device, install the Expo Go app on your Android or iOS phone. Then, connect to the same wireless network as your computer.  From here, proceed based on the operating system of your device:

Alternatively, run the application in a simulator or emulator by following the instructions presented in the terminal when running the following command:

npm start

Conclusion

In this reading, you explored the benefits of React Native and learned how to set up a new React Native application with the Expo framework.